'use strict';
/**
 * 复选框控制器
 */
app.controller('checkBox-list',
['$scope','$http', 'dialogs', '$state',
function($scope, $http, dialogs, $state) {
	var vm = $scope.vm = this;

	vm.checkItemList = [
		{name:"a",isChecked:true},
		{name:"b",isChecked:false},
		{name:"c",isChecked:false},
		{name:"d",isChecked:false}
	];
	//全选&全不选
	vm.selectAll = function () {
		angular.forEach(vm.checkItemList,function(checkBox){
			if (vm.isSelectAll){
				checkBox.isChecked = true;
			}else {
				checkBox.isChecked = false;
			}
		})
	}

	//反选
	vm.invertSelection = function () {
		angular.forEach(vm.checkItemList,function(checkBox){
			checkBox.isChecked = checkBox.isChecked?false:true;
		})
	}
	
}]);
			
